<?php

function __autoload($Book) {
require_once $Book . '.php';
}

class Library {
	private $books=array();
	
// 	function setBook($book) {
// 		$this->book = $book; 
// 	}

	public function addBook($book,$isbn) {
		//array_push($this->books, $book);
		$this->books[$isbn] = $book;
	}
	
	public function getBook($isbn) {
		//if (array_key_exist($isbn,$books))
		return $this->books[$isbn];
	}
	
	
	public function removeBook($isbn) {
		unset($this->books[$isbn]);
	}
	
}

$library = new Library();

$book = new Book();
$book->name = "Ad";
$book->author = "Dan Brown";
//add to library
$library->addBook($book, "252432432");



$book2 = new Book();
$book2->name = "Po sledite na bogovete";
$book2->author = "Nqmam ideq";
//add to library
$library->addBook($book2, "343242");

$library->removeBook("343242");
$danBook = $library->getBook("343242");
echo $danBook->name . " written by " . $danBook->author;
?>